from django.urls import converters  # 自由转换器


class UsernameConverter:
    regex = r'[a-zA-Z0-9_-]{5,20}'

    def to_python(self, value):
        return value


class MobileConverter:
    regex = r'1[1-9]{1}[0-9]{9}'

    def to_python(self, value):
        return value
